#-*-coding:utf-8-*-
'''
Created on 2013-3-30
C:/Users/zhaoyh/workspace/sysmanager/inifile.py
@author: zhaoyh
'''
import ConfigParser, os
filename = "config.conf"
def getvalue(Section, Key, Default = ""):
        conf=ConfigParser.ConfigParser()
        conf.readfp(open(filename))        

        try:
            value = conf.get(Section, Key)
        except:
            value = Default
        return value

def setvalue( Section, Key, Value):
    conf=ConfigParser.ConfigParser()
    try:
        conf.set(Section, Key, Value)
    except:
        conf.add_section(Section)
        conf.set(Section, Key, Value)
        conf.write(open(filename, 'w'))